package com.oracleoaec.server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
	public static void main(String[] args) {
		System.out.println("服务器开启...");
		Server server = new Server();
		server.start();
	}
	//启动服务器
	public void start() {
		try {
			@SuppressWarnings("resource")
			ServerSocket serverSocket = new ServerSocket(5055);
			while (true) {
				Socket socket = serverSocket.accept();
				System.out.println("★连接服务器成功");
				// 启动新线程处理客户端的请求
				new Thread(new ServerDispatchRequestRunnable(socket)).start();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
